package org.jeecg.modules.health_records.health_nervous.service.impl;

import org.jeecg.modules.health_records.health_nervous.entity.HealthNervousSysInfo;
import org.jeecg.modules.health_records.health_nervous.mapper.HealthNervousSysInfoMapper;
import org.jeecg.modules.health_records.health_nervous.service.IHealthNervousSysInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @Description: 现病史-体格检查-神经系统检查
 * @Author: jeecg-boot
 * @Date:   2025-06-25
 * @Version: V1.0
 */
@Service
public class HealthNervousSysInfoServiceImpl extends ServiceImpl<HealthNervousSysInfoMapper, HealthNervousSysInfo> implements IHealthNervousSysInfoService {
    @Autowired
    private HealthNervousSysInfoMapper healthNervousSysInfoMapper;
    /**按recordid查询**/
    @Override
    @Transactional(rollbackFor = Exception.class)
    public List<HealthNervousSysInfo> queryByRecordId(HealthNervousSysInfo healthNervousSysInfo) {
        return healthNervousSysInfoMapper.queryByRecordId(Long.valueOf(healthNervousSysInfo.getRecordid()),healthNervousSysInfo.getIdNumber());

    }
    /**电子病历信息查询接口（查询时间最新的那条数据）--按recordid查询**/
    @Override
    @Transactional(rollbackFor = Exception.class)
    public List<HealthNervousSysInfo> queryElecRecord(HealthNervousSysInfo healthNervousSysInfo) {
        return healthNervousSysInfoMapper.queryElecRecord(Long.valueOf(healthNervousSysInfo.getRecordid()),healthNervousSysInfo.getIdNumber());

    }

    //新规则查询当下时间往前12个月的就诊数据作为电子病历数据
    @Override
    @Transactional(rollbackFor = Exception.class)
    public List<HealthNervousSysInfo> newQueryElecRecord(HealthNervousSysInfo healthNervousSysInfo) {
        return healthNervousSysInfoMapper.newQueryElecRecord(Long.valueOf(healthNervousSysInfo.getRecordid()),healthNervousSysInfo.getSeeId(),healthNervousSysInfo.getIdNumber());

    }

    //新规则：除去当下时间往前12个月的就诊数据，剩下的数据为既往病历数据
    @Override
    @Transactional(rollbackFor = Exception.class)
    public List<HealthNervousSysInfo> newQueryPastRecord(HealthNervousSysInfo healthNervousSysInfo) {
        return healthNervousSysInfoMapper.newQueryPastRecord(Long.valueOf(healthNervousSysInfo.getRecordid()),healthNervousSysInfo.getSeeId(),healthNervousSysInfo.getIdNumber());

    }
    
}
